import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import LiveView from '../views/LiveView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/live',
      name: 'live',
      component: LiveView,
      meta: {
        keepAlive: true
      }
    },
    {
      path: '/video/:bvid',
      name: 'video',
      props: true,
      meta: {
        requierAuth: true
      },
      component: () => import('@/views/VideoView.vue')
    },
    {
      path: '/live-video',
      name: 'livevideo',
      component: () => import('@/components/livecomponents/LiveComponent.vue')
    },
    {
      path: '/search',
      name: 'search',
      meta: {
        isPath: true
      },
      component: () => import('@/views/SearchView.vue')
    },
    {
      path: '/user/:uid',
      name: 'user',
      props: true,
      component: () => import('@/views/BiliUser.vue')
    },
    {
      path: '/ranking/:rid',
      name: 'ranking',
      props: true,
      component: () => import('@/views/RankingListAll.vue')
    },
    {
      path: '/my',
      name: 'my',
      component: () => import('@/views/MyView.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/LoginView.vue')
    }
  ]
})

export default router
